/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_pays")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvPays.findAll", query = "SELECT c FROM CvPays c"),
    @NamedQuery(name = "CvPays.findById", query = "SELECT c FROM CvPays c WHERE c.id = :id"),
    @NamedQuery(name = "CvPays.findByCodePays", query = "SELECT c FROM CvPays c WHERE c.codePays = :codePays"),
    @NamedQuery(name = "CvPays.findByPaysfr", query = "SELECT c FROM CvPays c WHERE c.paysfr = :paysfr"),
    @NamedQuery(name = "CvPays.findByPaysen", query = "SELECT c FROM CvPays c WHERE c.paysen = :paysen")})
public class CvPays implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "code_pays")
    private String codePays;
    @Column(name = "paysfr")
    private String paysfr;
    @Column(name = "paysen")
    private String paysen;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvPays", fetch = FetchType.LAZY)
    private List<CvNationalitetravailleur> cvNationalitetravailleurList;
    @OneToMany(mappedBy = "cvPaysId", fetch = FetchType.LAZY)
    private List<CvTelephonetavaleur> cvTelephonetavaleurList;

    public CvPays() {
    }

    public CvPays(Integer id) {
        this.id = id;
    }

    public CvPays(Integer id, String codePays) {
        this.id = id;
        this.codePays = codePays;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCodePays() {
        return codePays;
    }

    public void setCodePays(String codePays) {
        this.codePays = codePays;
    }

    public String getPaysfr() {
        return paysfr;
    }

    public void setPaysfr(String paysfr) {
        this.paysfr = paysfr;
    }

    public String getPaysen() {
        return paysen;
    }

    public void setPaysen(String paysen) {
        this.paysen = paysen;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvNationalitetravailleur> getCvNationalitetravailleurList() {
        return cvNationalitetravailleurList;
    }

    public void setCvNationalitetravailleurList(List<CvNationalitetravailleur> cvNationalitetravailleurList) {
        this.cvNationalitetravailleurList = cvNationalitetravailleurList;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvTelephonetavaleur> getCvTelephonetavaleurList() {
        return cvTelephonetavaleurList;
    }

    public void setCvTelephonetavaleurList(List<CvTelephonetavaleur> cvTelephonetavaleurList) {
        this.cvTelephonetavaleurList = cvTelephonetavaleurList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvPays)) {
            return false;
        }
        CvPays other = (CvPays) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvPays[ id=" + id + " ]";
    }
    
}
